<template>
	<view class="box pt20">
		<view style="margin-top: 20vh;" v-if="!list[0]">
			<u-empty mode="list"></u-empty>
		</view>
		<view v-else>
			<view class="boxItem mb20 mlr20" v-for="(item,index) in list" :key="item.handletime">
				<view class="flex mb20">
					<view class="name w160">本环节：</view>
					<view class="value">{{item.troublestatus2}}</view>
				</view>
				<view class="flex mb20">
					<view class="name w160">本环节处理人：</view>
					<view class="value">{{item.handleUser}}</view>
				</view>
				<view class="flex mb20">
					<view class="name w160">下一环节：</view>
					<view class="value">{{item.nextTroublestatus2}}</view>
				</view>
				<view class="flex mb20">
					<view class="name w160">下一环节处理人(部门)：</view>
					<view class="value">{{item.taskUser}}</view>
				</view>
				<view class="flex mb40">
					<view class="name w160">处理状态：</view>
					<view class="cob1" v-if="item.processState != 3">正常</view>
					<view class="cob2" v-else>退回</view>
				</view>
				<view class="mtb20">
					<u-line color="#F5F6F9"></u-line>
				</view>
				<view class="flex flex-itemCenter">
					<image style="width: 28rpx;height: 28rpx;margin-top: 4rpx;" src="../../static/agentTime.png">
					</image>
					<text class="time">{{item.handletime}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: '0',
				params: {
					troubleId: ''
				},
				list: [],
				dictList: []
			}
		},
		onLoad(e) {
			if (e.item) {
				this.params.troubleId = JSON.parse(e.item).troubleId
			}
			if (e.dictList) {
				this.dictList = JSON.parse(e.dictList)
			}
		},
		onShow() {
			this.queryProcessInfo2()
		},
		methods: {
			async queryProcessInfo2() {
				let {
					resultValue: res
				} = await this.request(this.$api.queryProcessInfo2, this.params, 'POST')
				this.list = res.items
				this.dict()
			},
			dict() {
				let arr = []
				this.dictList.forEach((item) => {
					if (item.name == 'currentState2') {
						arr.push(...item.values)
					}
				})
				console.log(arr)
				arr.forEach((item) => {
					this.list.forEach(i => {
						console.log(i.troublestatus2)
						if (i.troublestatus2 == item.value) {
							i.troublestatus2 = item.text
						}
						if (i.nextTroublestatus2 == item.value) {
							i.nextTroublestatus2 = item.text
						}
					})
				})
			}

		}
	}
</script>

<style scoped>
	.box {
		min-height: 100vh;
		background-color: #F1F2F5;
	}

	.boxItem {
		padding: 40rpx;
		background-color: #fff;
		box-shadow: 0 2px 4px 0 rgba(237, 237, 237, 0.50);
		border-radius: 16rpx;
		position: relative;
	}

	.name {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #89939E;
		padding-right: 20rpx;
	}

	.value {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
	}

	.cob1 {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #30BA05;
	}

	.cob2 {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFA428;
	}

	.time {
		margin-left: 10rpx;
		font-size: 24rpx;
		color: #939EA8;
	}
</style>
